package com.hw.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Classname: ApplicationContextConfig
 * @Description: 描述
 * @Date: 2021/6/9
 * @Author: huwei
 */
@Configuration
public class ApplicationContextConfig {

    /**
     * 注入RestTemplate
     * @LoadBalanced让RestTemplate使用负载均衡策略
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
